home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CommToolbox (modified) / Headers / CThread.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  1.7 KB  |  74 lines  |  [TEXT/KAHL]

  1. /* ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
  2.  
  3.     CThread.h
  4.     
  5.     Thread Manager class.
  6.     
  7.     SUPERCLASS = CObject.
  8.     
  9.     Copyright © 1994-95 Ithran Einhorn. All rights reserved.
  10.     
  11. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ */
  12.  
  13. #ifndef _H_CThread
  14. #define _H_CThread
  15.  
  16. #include <CObject.h>                /* Interface for its superclass */
  17.  
  18. #include "Threads.h"                /* Apple Includes */
  19.  
  20. class CCluster;
  21.  
  22. /* Class definition */
  23.  
  24. #define        kPoolSegment    10        // number of threads to allocate at a time
  25.  
  26. class CThread : public CObject    {
  27.  
  28. protected:
  29.  
  30.     /* Class Variables */
  31.     
  32.     static CCluster    *cThreadList;
  33.     static    long    threadCount;
  34.  
  35.     /* Instance Variables */
  36.     Str32        threadName;
  37.     ThreadID    itsThreadID;
  38.     ThreadStyle    itsThreadStyle;
  39.     CObject        *itsObject;
  40.     OSErr        lastThreadErr;
  41.     Boolean        isActive;
  42.     
  43. public:
  44.  
  45.     /* Instance Variables */
  46.  
  47.     Boolean            active;
  48.     
  49.     /* Class Methods */
  50.     
  51.     static Boolean    cIsPresent(void);
  52.     static void        cInitManager(void);
  53.     static short    cGetTMVersion(void);
  54.     static CThread    *ThreadObjectFromID(ThreadID threadID);
  55.     static OSErr    YieldToThread (CThread *suggestedThread);
  56.     static CThread    *GetCurrentThread (void);
  57.  
  58.     /* Instance Methods */
  59.     
  60.     void            IThread(ThreadStyle    threadStyle, ThreadEntryProcPtr callBackFunction, CObject *threadedObject, Size stackSize = 0);
  61.     virtual void    Dispose(void);
  62.     ThreadID        GetID(void);
  63.     void            SetName(Str32 name);
  64.     OSErr            LastError(void);
  65.     Boolean            IsActive(void);
  66.     OSErr            CurrentStackSpace(unsigned long *freeStack);
  67.     OSErr            GetThreadState(ThreadState *threadState);
  68.     OSErr            SetThreadState(ThreadState newState,CThread *suggestedThread);
  69. };
  70.  
  71. #endif
  72.  
  73. /* ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ */
  74.